﻿using BilbilBLL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Modles.DTO;
using Modles.Models;

namespace bilbil.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ManageImageController : ControllerBase
    {
        [HttpGet]
        public IActionResult GetImagesByIdOrDescription(int Id, string? Description)
        {
            return new JsonResult(new ManageImageServer().GetImagesByIdOrDescription(Id, Description));
        }
        [HttpPost]
        public IActionResult AddImage(Image_DTO image)
        {
            return new JsonResult(new ManageImageServer().AddImage(image));
        }
        [HttpDelete]
        public IActionResult DeleteImage(int Id)
        {
            return new JsonResult(new ManageImageServer().DeleteImage(Id));
        }
        [HttpPut]
        public IActionResult UpdataImage(Image image)
        {
            return new JsonResult(new ManageImageServer().UpdataImage(image));
        }
    }
}
